#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 310;
const int M = 1e9 + 7;

const int INF = 0x3f3f3f3f;

int dp[N][N];
int n, x, y;

int a[N], b[N];

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> n >> x >> y;
    for (int i = 1; i <= n; i++)
        cin >> a[i] >> b[i];

    memset(dp, 0x3f, sizeof(dp));

    dp[0][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 300; j >= 0; j--) {
            for (int k = 300; k >= 0; k--) {
                dp[j][k] = min(dp[j][k], dp[max(0, j - a[i])][max(0, k - b[i])] + 1);
            }
        }
    }

    int ans = INF;

    for (int i = x; i <= 300; i++) {
        for (int j = y; j <= 300; j++)
            ans = min(ans, dp[i][j]);
    }

    if (ans == INF)
        ans = -1;
    cout << ans << endl;
    return 0;
}  